#{extends 'overlay.html'/}

<h2 id="crudBlankTitle">Edit the meeting note</h2>
	
<div class="objectForm">

<label for="object_name"> Note :</label> <br>
<textArea id="note_field" type="text"  rows ="5" cols="52" value="${n.description}" ></textArea> 
<span class="crudHelp" style="color:red">*</span>
</div>
<p class="crudButtons">
			<input type="button" value="Edit note" onClick="edit_note(${n.id},${meeting.id})" />
</p>

<script type="text/javascript">

$(function(){$('#note_field').val('${n.description}');});
function edit_note(nid,mid)
{
	var text= $('#note_field').val();
	if(text=="")
	{
		window.parent.$.bar({message:'Please enter a valid note.'});
	}
	else
	{
		$.post('/Meetings/editTheNote',{noteId:nid , meetingId:mid , note:text},
				function(flag)
				{
					if(flag)
					{
						window.parent.$.bar({message:'Note edited successfully'});
						window.parent.$('#getOverlay').hide();
						
					}
					else
					{
						window.parent.$.bar({message:'Error occurred while editing the note.'});
						window.parent.$('#getOverlay').hide();
					}
				})
	}
}

</script>